package cn.com.pc.content.domain;

import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonValue;

/**
 * 站点
 */
public enum Site {
    PCOnline("pconline", "太平洋电脑网"),
    PCAuto("pcauto", "太平洋汽车网"),
    PCBaby("pcbaby", "太平洋亲子网"),
    PCHouse("pchouse", "太平洋家居网"),
    Unknown("unknown", "未知");


    private final String name;
    private final String fullname;

    Site(String name, String fullname) {
        this.name = name;
        this.fullname = fullname;
    }

//    @JsonCreator
    public static Site getSourceByName(String name) {
        for (Site site : values()) {
            if (site.getName().equals(name)) {
                return site;
            }
        }
        return Unknown;
    }

//    @JsonValue
    public String getName() {
        return this.name;
    }

    public String getFullname() {
        return this.fullname;
    }
}
